import baserun
import openai
async def answer_question(question: str) -> str:
    # Register a template with your template string (`TEMPLATES` constant in this codebase)
    await baserun.aregister_template(TEMPLATES.get(template_name), template_name)
    # Use the template to format the prompt, then send it to OpenAI
    prompt = await baserun.format_prompt(
        template_name=template_name,
        template_messages=TEMPLATES.get(template_name),
        parameters={"question": question},
    )
    client = AsyncOpenAI()
    completion = await client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=prompt,
    )
    return completion.choices[0].message.content